﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Net;

namespace PoolGame2.Managers
{
    enum GameEventID
    {
        UNKNOWN = 0,
        NIXON_SAY,

        NETWORK_CUE_STRIKE,

    };

    public class GameEvent
    {
        public int EventID;
        public String EventDesc;
        public PacketReader data;

        public GameEvent(int id, String str, PacketReader d)
        {
            EventID = id;
            EventDesc = str;
            data = d;
        }

        public GameEvent(int id, PacketReader d)
        {
            EventID = id;
            EventDesc = "";
            data = d;
        }

        public GameEvent(int id, String str)
        {
            EventID = id;
            EventDesc = str;
            data = null;
        }

        public GameEvent(int id)
        {
            EventID = id;
            EventDesc = "";
            data = null;
        }
    }

    public interface IGameEventListener
    {
        void GameEventPerformed(GameEvent e);
    }

    public class ManagerGameEvent : GameComponent
    {
        public List<IGameEventListener> eventListeners;

        public ManagerGameEvent(PoolGame game) : base(game)
        {
            eventListeners = new List<IGameEventListener>();
        }

        public void FireEvent(GameEvent e)
        {
            foreach (IGameEventListener listener in eventListeners)
            {
                listener.GameEventPerformed(e);
            }
        }
    }
}
